from manger import redis_store

redis_zhibokey = 'kpkey'
redis_zhibokey1 = 'kpkey1'
redis_candidate_codes = 'candidate_codes'
redis_selected_codes = 'selected_codes'
redis_last_dates = 'last_dates'
redis_top5_concept = 'top5_concept'
redis_kpl_token = 'kpl_token'
redis_tld_token = 'tld_token'
redis_login_count = 'login_count'
redis_lx_last_trade_date = 'lx_last_trade_date'
redis_lx_kpl_hot_concepts = 'kpl_hot_concepts'

def get_zhibokey():
    return redis_store.get(redis_zhibokey)
def set_zhibokey(zhibokey):
    redis_store.set(redis_zhibokey, zhibokey)

def get_zhibokey1():
    return redis_store.get(redis_zhibokey1)
def set_zhibokey1(zhibokey):
    redis_store.set(redis_zhibokey1, zhibokey)
def get_last_date():
    last_dates = redis_store.get(redis_last_dates)
    if last_dates is None:
        return []
    else:
        return last_dates.split(',')

def set_last_date(last_dates):
    redis_store.set(redis_last_dates, last_dates)


def get_top5_concept():
    concepts = redis_store.get(redis_top5_concept)
    if concepts is None:
        return []
    else:
        return concepts.split(',')

def set_top5_concept(concepts):
    redis_store.set(redis_top5_concept, concepts)

# 获取redis精选股票codes
def get_seleted_codes():
    concepts = redis_store.get(redis_selected_codes)
    if concepts is None:
        return []
    else:
        return concepts.split(',')

def set_seleted_codes(concepts):
    redis_store.set(redis_selected_codes, concepts)

def get_candidate_codes():
    concepts = redis_store.get(redis_candidate_codes)
    if concepts is None:
        return []
    else:
        return concepts.split(',')
def set_candidate_codes(concepts):
    redis_store.set(redis_candidate_codes, concepts)

def get_kpl_token():
    kpl_token = redis_store.get(redis_kpl_token)
    return kpl_token

def set_kpl_token(kpl_token):
    redis_store.set(redis_kpl_token, kpl_token)

def get_tld_token():
    tld_token = redis_store.get(redis_tld_token)
    return tld_token

def set_tld_token(tld_token):
    redis_store.set(redis_tld_token, tld_token)

def get_login_count():
    login_count = redis_store.get(redis_login_count)
    return login_count

def set_login_count(login_count):
    redis_store.set(redis_login_count, login_count)

def get_lx_last_trade_date():
    last_trade_date = redis_store.get(redis_lx_last_trade_date)
    return last_trade_date

def set_lx_last_trade_date(last_trade_date):
    redis_store.set(redis_lx_last_trade_date, last_trade_date)

def get_lx_kpl_hot_concepts():
    kpl_hot_concepts = redis_store.get(redis_lx_kpl_hot_concepts)
    return kpl_hot_concepts

def set_lx_kpl_hot_concepts(kpl_hot_concepts):
    print('====')
    redis_store.set(redis_lx_kpl_hot_concepts, kpl_hot_concepts)




